import request from "@/utils/request.js";
const baseUrl = '/cloud-sys-service/exam-template'

/**
 * 分页查询考试
 */
export function page(data){
  return request({
    url: baseUrl + '/page',
    method: 'post',
    data
  })
}

/**
 * 生成试卷模板
 */
export function createExam(data){
  return request({
    url: baseUrl + '/create-exam',
    method: 'post',
    data
  })
}

/**
 * 获取试卷模板
 */
export function infoExam(id){
  return request({
    url: baseUrl + `/info-exam?id=${id}`,
    method: 'get',
  })
}

/**
 * 获取题库下拉列表
 */
export function listQuestionGroupOptions() {
  return request({
    url: baseUrl + "/listQuestionGroupOptions",
    method: "get"
  });
}

/**
 * 通过id查询考试
 */
export function getById(params) {
  return request({
    url: baseUrl + '/getById',
    method: 'get',
    params
  })
}

/**
 * 新增考试
 */
export function add(data) {
  return request({
    url: baseUrl + '/add',
    method: 'post',
    data
  })
}

/**
 * 通过id修改考试
 */
export function update(data) {
  return request({
    url: baseUrl + '/updateById',
    method: 'post',
    data
  })
}

/**
 * 新增或修改考试记录
 */
export function save(data) {
  return request({
    url: baseUrl + '/saveOrUpdate',
    method: 'post',
    data
  })
}

/**
 * 通过id删除考试记录
 */
export function removeById(id) {
  return request({
    url: baseUrl + `/removeById?id=${id}`,
    method: 'get',
  })
}

// 列表相关列信息
export const columnInfo = [
  {
    "title":"序号",
    "type":"seq",
    "fixed":"left",
    "align":"center",
    "width":"60"
  },
  {
    "title":"试卷名称",
    "field":"examName",
    "align":"center",
    "showOverflow":"title",
    "minWidth":"120"
  },
  {
    "title":"满分",
    "field":"fullScore",
    "align":"center",
    "width":"60"
  },
  {
    "title":"及格分",
    "field":"passScore",
    "align":"center",
    "width":"60"
  },
  {
    "title":"题目数量",
    "field":"questionTotal",
    "align":"center",
    "width":"80"
  },
  {
    "title":"考试状态",
    "field":"examStatus",
    "proxyColumn":true,
    "align":"center",
    "width":"80"
  },
  {
    "title":"注意事项",
    "field":"carefulNotice",
    "align":"center",
    "showOverflow":"title",
    "minWidth":"600"
  },
  {
    "title":"创建时间",
    "field":"createTime",
    "align":"center",
    "minWidth":"130"
  },
  {
    "title":"操作",
    "field":"operate",
    "fixed":"left",
    "align":"center",
    "proxyColumn":true,
    "width":"160px",
    /*"options":[
        {
            "text":true,
            "btnName":"重置密码",
            "type":"primary",
            "icon":"RefreshLeft",
            "method":"showFormDialog"
        },
    ]*/
  }
]
